class ExamRank {
  String realName;
  String deptName;
  String examName;
  String headUrl;
  int userRank;
  double userScore;

  List<ExamRankItem> frontRankList;
  List<ExamRankItem> behindRankList;

  ExamRank({
    this.realName,
    this.deptName,
    this.examName,
    this.headUrl,
    this.userRank,
    this.userScore,
    this.frontRankList,
    this.behindRankList,
  });

  factory ExamRank.fromJson(Map<String, dynamic> json) {
    return ExamRank(
      realName: json['realName'],
      deptName: json['deptName'],
      examName: json['examName'],
      headUrl: json['headUrl'],
      userRank: json['userRank'],
      userScore: json['userScore'] ?? 0.0,
      frontRankList: json['frontRankList'] == null ? [] : (json['frontRankList'] as List).map((e) => ExamRankItem.fromJson(e)).toList(),
      behindRankList: json['behindRankList'] == null ? [] : (json['behindRankList'] as List).map((e) => ExamRankItem.fromJson(e)).toList(),
    );
  }
}

class ExamRankItem {
  String realName;
  String deptName;
  String headUrl;
  int rank;
  double score;

  ExamRankItem({
    this.realName,
    this.deptName,
    this.headUrl,
    this.rank,
    this.score,
  });

  factory ExamRankItem.fromJson(Map<String, dynamic> json) {
    return ExamRankItem(
      realName: json['realName'],
      deptName: json['deptName'],
      headUrl: json['headUrl'],
      rank: json['rank'],
      score: json['score'] ?? 0.0,
    );
  }
}
